\documentclass[10pt, twocolumn]{article}

\usepackage{listings}
\usepackage{multicol}
\usepackage{fullpage}
\usepackage[hmargin=1cm,vmargin=2cm]{geometry}
\usepackage{boxedminipage}

\newcommand{\topic}[1]{
\hRule

{\sf{\textbf{#1}}}
\vspace{0.05in}

%\hRule
}
\newcommand{\code}[1]{\lstinline[basicstyle=\small\ttfamily]{#1}}
\newcommand{\hRule}{\rule{\linewidth}{0.2mm}}

\newcommand{\Indent}{\hspace{0.2in}}


\newcommand{\desc}[1]{\Indent\parbox[b]{3.5in}{#1}}




%------------------------------------------------------------------------------
\begin{document}
%------------------------------------------------------------------------------
%\begin{multicols}{2}

\thispagestyle{empty} % suppress page #s



%------------------------------------------------------------------------------
{
\Large{\sf\textit{WindowTester API Quick Reference (v.0.1)}}
}

%------------------------------------------------------------------------------


%------------------------------------------------------------------------------
%------------------------------------------------------------------------------
\topic{IUIContext Methods}
%------------------------------------------------------------------------------

\code{ILocator click(ILocator locator)}

\desc{click the widget identified by this locator}

\code{ILocator contextClick(ILocator locator, String path)}

\desc{select the given context menu path on this widget}

\code{void enterText(String text)}

\desc{enter the given text}

\code{IWidgetLocator find(ILocator locator)}

\desc{find the widget identified by this locator}

\code{IWidgetLocator[] findAll(ILocator locator)}

\desc{find all the widgets identified by this locator}

\code{IWidgetLocator dragTo(ILocator locator)}

\desc{drag from the current hover position to this locator}

\code{void wait(ICondition condition)}

\desc{wait for this condition to become true}

\code{void assertThat(ICondition condition)}

\desc{assert that this condition is true}

%\code{IConditionMonitor getConditionMonitor()}
%
%\desc{get the current condition monitor}


%------------------------------------------------------------------------------
%------------------------------------------------------------------------------
\topic{Locators}
%------------------------------------------------------------------------------



%
%\begin{boxedminipage}[t]{0.95\linewidth}
%
%\code{com.windowtester.runtime.swt.locator} \\
%\indent\desc{SWT locators (Buttons, Combos, Trees, etc)}\\
%\code{com.windowtester.runtime.swt.locator.eclipse} \\
%\indent\desc{Eclipse locators (Editors, Views, Perspectives, etc)}\\
%\code{com.windowtester.runtime.swt.locator.jface} \\
%\indent\desc{JFace locators (Dialogs, Wizards, etc)}
%
%%\hspace{2.8in} {\sf{packages}}
%
%\end{boxedminipage}
%
%\desc{}
%
%\desc{}


\code{new TreeItemLocator(``General/Project'')}

\desc{the tree item ``Project'' with parent ``General''}

\code{new TreeItemLocator(``(General|Simple)/Project'')}

\desc{the tree item ``Project'' with parent ``General'' or ``Simple''}

\code{new TreeItemLocator(``Project'',}
\indent\indent\indent\code{new ViewLocator(``org.acme.Explorer''))}

\desc{the tree item ``Project'' in the ``org.acme.Explorer'' view}

\code{new MenuItemLocator(``Window/&Preferences(...)?'')}

\desc{the preferences menu (with or without trailing dots)}

%\code{new TableCellLocator(``user'', ``id'')}
%
%\desc{the table cell at row ``user'' and column ``id''}

\code{new CTabItemLocator(``.*'')}

\desc{all CTabItems}

\code{new XYLocator(new TableItemLocator(``Java''), -5, 5)}

\desc{the offset -5,5 from the top-left of the ``Java'' table item}

\code{new LRLocator(3, new FigureClassLocator("Ellipse"))}

\desc{the 4th ellipse figure scanning left to right}



%------------------------------------------------------------------------------
%------------------------------------------------------------------------------
\topic{Conditions}
%------------------------------------------------------------------------------

\code{ui.wait(new ShellShowingCondition(``New Project''))}

\desc{wait for the ``New Project'' shell to be showing}

\code{ui.wait(new ViewLocator(``JUnit'').isVisible()))}

\desc{wait for the JUnit view to be visible}

\code{ui.wait(new ProjectExistsCondition(``org.acme.MyProject''))}

\desc{wait for the ``org.acme.MyProject'' to exist}

\code{ui.wait(new JobsCompleteCondition())}

\desc{wait for the all the Eclipse Jobs to be complete}

%\code{ui.wait(new ICondition() \{} \\
%\indent\indent\code{public boolean test() \{} \\
%\indent\indent\indent\code{return something();} \\
%\indent\indent\code{\}}\\
%\indent\code{\})}
%
%\desc{wait for \textit{something} to be true}


%------------------------------------------------------------------------------
%------------------------------------------------------------------------------
\topic{Assertions}
%------------------------------------------------------------------------------


\code{ui.assertThat(new ButtonLocator(``OK'').isEnabled())}

\desc{assert that the ``OK'' button is enabled}

\code{ui.assertThat(new EditorLocator(``Foo.java'').isActive())}

\desc{assert that the editor open on ``Foo.java'' is active}

\code{ui.assertThat(}\\
\indent\indent\code{new DialogMessageLocator().hasText(``Error''))}

\desc{assert that the open dialog has the message ``Error''}

   


%------------------------------------------------------------------------------
%------------------------------------------------------------------------------
\topic{Condition Monitors}
%------------------------------------------------------------------------------

\code{IShellMonitor sm =} \\
\indent\indent\indent\code{(IShellMonitor)ui.getAdapter(IShellMonitor.class)}
\indent\code{sm.add(new PerspectiveSwitchedShellHandler())}

\desc{register a handler that clicks the ``No'' button on the
``Confirm Perspective Switch'' Shell.}


%------------------------------------------------------------------------------
%------------------------------------------------------------------------------
\topic{Text Entry}
%------------------------------------------------------------------------------

\code{ui.enterText(``MyProject'')}

\desc{type ``MyProject''}

\code{ui.keyClick(WT.CTRL, `s')}

\desc{click CTRL+S}

\code{ui.keyClick(WT.SHIFT | WT.END)}

\desc{click the SHIFT and END keys at once}


%------------------------------------------------------------------------------
%------------------------------------------------------------------------------
\topic{Naming}
%------------------------------------------------------------------------------

\code{button.setData(``name'', ``named.button'')}

\desc{give the button the name ``named.button''}

\code{ui.find(new NamedWidgetLocator(``named.widget''))}

\desc{find the ``named.button'' button at runtime}


%------------------------------------------------------------------------------
%------------------------------------------------------------------------------
\topic{Widget Access}
%------------------------------------------------------------------------------

\code{IWidgetLocator wl = ui.find(new ButtonLocator(``OK''))}

\desc{find the ``OK'' button}

\code{final Button b = (Button)((IWidgetReference)wl).getWidget()}

\desc{get the underlying widget}



\code{final boolean[] result = new boolean[1];}
\indent\code{Display.getDefault().syncExec(new Runnable() \{} \\
\indent\indent\code{public void run() \{} \\
\indent\indent\indent\code{result[0] = button.getAlignment();} \\
\indent\indent\code{\}}\\
\indent\code{\});} \\
\indent\code{assertEquals(SWT.UP, result[0]);}

%\hspace{-0.11in}
%\begin{tabular}{|l}
%\code{final boolean[] result = new boolean[1];} \\
%\indent\code{Display.getDefault().syncExec(new Runnable() \{} \\
%\indent\indent\code{public void run() \{} \\
%\indent\indent\indent\code{result[0] = button.getAlignment();} \\
%\indent\indent\code{\}}\\
%\indent\code{\});} \\
%\indent\code{assertEquals(SWT.UP, result[0]);}
%\end{tabular}

\desc{access the alignment property safely on the UI thread}


%------------------------------------------------------------------------------
%------------------------------------------------------------------------------
\topic{Constants}
%------------------------------------------------------------------------------

\code{WT.ARROW_RIGHT}

\desc{the right arrow key code}

\code{WT.setDefaultWaitTimeOut(120000)}

\desc{override the default wait timeout to be 2 minutes (in ms)}




%------------------------------------------------------------------------------
%------------------------------------------------------------------------------
\topic{Drag and Drop}
%------------------------------------------------------------------------------


\code{ui.click(new TreeItemLocator(``accounts/due/PGE''));}
\indent\code{ui.dragTo(new TreeItemLocator(``accounts/paid''));}

\desc{drag ``PGE'' node to ``accounts/paid''}

\code{ui.mouseMove(new AndGateLocator);}
\indent\code{ui.dragTo(new FigureCanvasXYLocator(50, 50);}

\desc{drag the And gate to position (50,50) on the canvas}

\code{ui.click(new ResizeHandleLocator(Position.TOP,} \\
\indent\indent\indent\code{new FigureClassLocator("AndGate");} \\
\indent\code{ui.dragTo(new FigureCanvasXYLocator(60,10));}

%\begin{tabular}{|l}
%\code{ui.click(new ResizeHandleLocator(Position.TOP,} \\
%\indent\indent\indent\code{new AndGateLocator();} \\
%\code{ui.dragTo(new FigureCanvasXYLocator(60,10));}
%\end{tabular}

\desc{resize the And gate figure using its TOP handle}



%------------------------------------------------------------------------------
%------------------------------------------------------------------------------

%\end{multicols}
%------------------------------------------------------------------------------



\end{document} 